function cellInfo = FMS_Out_Bus(varargin) 
% FMS_OUT_BUS returns a cell array containing bus object information 
% 
% Optional Input: 'false' will suppress a call to Simulink.Bus.cellToObject 
%                 when the MATLAB file is executed. 
% The order of bus element attributes is as follows:
%   ElementName, Dimensions, DataType, SampleTime, Complexity, SamplingMode, DimensionsMode, Min, Max, DocUnits, Description 

suppressObject = false; 
if nargin == 1 && islogical(varargin{1}) && varargin{1} == false 
    suppressObject = true; 
elseif nargin > 1 
    error('Invalid input argument(s) encountered'); 
end 

cellInfo = { ... 
  { ... 
    'FMS_Out_Bus', ... 
    '', ... 
    '', ... 
    'Auto', ... 
    '-1', {... 
{'timestamp', 1, 'uint32', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('ms'), sprintf('fms output timestamp')}; ...
{'p_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad/s'), sprintf('roll rate command in body frame')}; ...
{'q_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad/s'), sprintf('pitch rate command in body frame')}; ...
{'r_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad/s'), sprintf('yaw rate command in body frame')}; ...
{'phi_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad'), sprintf('roll command in body frame')}; ...
{'theta_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad'), sprintf('pitch command in body frame')}; ...
{'psi_rate_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('rad/s'), sprintf('yaw rate command in body frame')}; ...
{'u_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s'), sprintf('velocity x command in control frame')}; ...
{'v_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s'), sprintf('velocity y command in control frame')}; ...
{'w_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s'), sprintf('velocity z command in control frame')}; ...
{'ax_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s^2'), sprintf('acceleration x command in control frame')}; ...
{'ay_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s^2'), sprintf('acceleration y command in control frame')}; ...
{'az_cmd', 1, 'single', -1, 'real', 'Sample', 'Fixed', [], [], sprintf('m/s^2'), sprintf('acceleration z command in control frame')}; ...
{'actuator_cmd', 16, 'uint16', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('actuator command')}; ...
{'throttle_cmd', 1, 'uint16', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('throttle command')}; ...
{'cmd_mask', 1, 'uint16', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('Type mask for offboard mode:\n  1: p_cmd valid\n  2: q_cmd valid\n  3: r_cmd valid\n  4: phi_cmd valid\n  5: theta_cmd valid\n  6: psi_rate_cmd_valid\n  7: u_cmd valid\n  8: v_cmd valid\n  9: w_cmd valid\n10: ax_cmd valid\n11: ay_cmd valid\n12: ax_cmd valid\n13: throttle_cmd valid')}; ...
{'status', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('enum VehicleStatus\n\nvehicle status:\n0: None\n1: Disarm\n2: Standby\n3: Arm')}; ...
{'state', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('enum VehicleState\n\nvehicle state:\n0: None\n1: Disarm\n2: Standby\n3: Offboard\n4: Mission\n5: InvalidAutoMode\n6: Hold\n7: Acro\n8: Stabilize\n9: Altitude\n10: Position\n11: InvalidAssistMode\n12: Manual\n13: InvalidManualMode\n14: InvalidArmMode\n15: Land\n16: Return\n17: Takeoff')}; ...
{'ctrl_mode', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('enum ControlMode\n\ncontrol mode:\n0: None\n1: Manual\n2: Acro\n3: Stabilize\n4: ALTCTL\n5: POSCTL')}; ...
{'mode', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('enum PilotMode\n\npilot mode:\n0: None\n1: Manual\n2: Acro\n3: Stabilize\n4: Altitude\n5: Position\n6: Mission\n7: Offboard')}; ...
{'reset', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('reset the controller')}; ...
{'wp_consume', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('consumed waypoints')}; ...
{'wp_current', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('current waypoint')}; ...
{'reserved', 1, 'uint8', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('enum of PilotMode')}; ...
{'home', 4, 'single', -1, 'real', 'Sample', 'Fixed', [], [], '', sprintf('home position [x y h yaw], unit [m m m rad]')}; ...
    } ...
  } ...
}'; 

if ~suppressObject 
    % Create bus objects in the MATLAB base workspace 
    Simulink.Bus.cellToObject(cellInfo) 
end 
